<?php
function printGraph($module) {
    $home_path = get_home_path();
    $processor = '../'.substr(dirname(__FILE__).'/tantan_reports_load.php', strlen( $home_path ));
?>
<iframe scrolling="No" src="<?php echo $processor;?>?module=<?php echo $module['module'];?>&amp;report=<?php echo $module['report'];?>" frameborder="0"></iframe>

<?php
}
function printWideGraph($module) {
    $home_path = get_home_path();
    $processor = '../'.substr(dirname(__FILE__).'/tantan_reports_load.php', strlen( $home_path ));
?>
    <iframe class="wide" scrolling="No" src="<?php echo $processor;?>?module=<?php echo $module['module'];?>&amp;report=<?php echo $module['report'];?>" frameborder="0"></iframe>
<?php    
}
function printWideShortGraph($module) {
    $home_path = get_home_path();
    $processor = '../'.substr(dirname(__FILE__).'/tantan_reports_load.php', strlen( $home_path ));
?>
    <iframe class="wide short" scrolling="No" src="<?php echo $processor;?>?module=<?php echo $module['module'];?>&amp;report=<?php echo $module['report'];?>" frameborder="0"></iframe>
<?php    
}
?>

<style type="text/css">
div.reports iframe {
    width:350px;
    height:350px;
    border:0;
    margin:0 20px 0px 0;
}
div.reports iframe.wide {
    display:block;
    width:97%;
    height:150px;
    clear:both;
}
div.reports iframe.short {
    height:3em;
}
</style>

<div class="wrap reports">
<h2>7 Day Traffic Summary</h2>

<?php
if (is_array($modules)) foreach ($modules as $module) {
    switch ($module['module']) {
        case 'feedburner':
            printGraph($module);
        break;
        case 'analytics':
            switch ($module['report']) {
                case '7dayreport':
                    printWideShortGraph($module);
                break;
                case 'newreturn':
                    printWideGraph($module);
                break;
                default:
                    printGraph($module);
                break;
            }
        break;
    }
}
?>


<?php /*

<h2>7 Day Traffic Summary</h2>
<?php if ($visitsNow > 0 && $viewsNow > 0):?>
<p>
During the past 7 days, your site received
<strong><?php echo number_format($visitsNow)?></strong> visitors <?php echo $visitsPercentLabel?> and 
<strong><?php echo number_format($viewsNow)?></strong> pageviews <?php echo $viewsPercentLabel?>.
</p>
<?php endif;?>

<?php if ($showAllReports || ($gaShowReports['visits'] && $visitspageviews)) printVertGraph('Daily Visits', $visitspageviews['Visits']['records'], $visitspageviews['Visits']['MaxVisits'], 'Date Range', 'Visits', 'Number of people that visited your site');?>

<?php if ($showAllReports || ($gaShowReports['pageviews'] && $visitspageviews)) printVertGraph('Daily Pageviews', $visitspageviews['Pageviews']['records'], $visitspageviews['Pageviews']['MaxPageviews'], 'Date Range', 'Pageviews', 'How many pages were viewed');?>

<?php if ($showAllReports || ($gaShowReports['avgpageviews'] && $visitspageviews)) printVertGraph('Avg Pageviews per Visit', $visitspageviews['Average Pageviews per Visit']['records'], $visitspageviews['Average Pageviews per Visit']['MaxP/Visit'], 'Date Range', 'P/Visit', 'Average number of pageviews per visit');?>

<?php
if (is_array($feedburner)) {
    foreach ($feedburner as $fb) {
        printVertGraph('Daily Circulation <small>- '.$fb['uri'].'</small>', $fb['records'], $fb['MaxCirculation'], 'Date Label', 'Circulation', 'Number of subscribers to your content');
    }
}?>

<?php if ($showAllReports || ($gaShowReports['inbound'] && $inbound)) printHorizGraph('Inbound Sources', $inbound['Referring Source']['records'], $inbound['Referring Source']['MaxVisits'], 'Visits', 'Source [Medium]', 'How did people find your site');?>

<?php if ($showAllReports || ($gaShowReports['outbound'] && $outbound)) printHorizGraph('Outbound Links', $outbound['Top Content']['records'], $outbound['Top Content']['MaxUniq. Views'], 'Uniq. Views', 'Content', 'External sites people went to from your site');?>

<?php if ($showAllReports || ($gaShowReports['popular'] && $topcontent)) printHorizGraph('Popular Content', $topcontent['Top Content']['records'], $topcontent['Top Content']['MaxUniq. Views'], 'Uniq. Views', 'Content', 'Most popular content on your site');?>

<?php if ($showAllReports || ($gaShowReports['entry'] && $entrance)) printHorizGraph('Entry Pages', $entrance['Entrance Bounce Rates']['records'], $entrance['Entrance Bounce Rates']['MaxEntrances'], 'Entrances', 'Top Entrances','First page people visit on your site');?>



<?php if ($showAllReports || ($gaShowReports['newreturn'] && $executive)):?>

<br clear="all"/>
<?php
$totalVisits = $executive['Visits by New and Returning']['records'][0]['Visits'] + $executive['Visits by New and Returning']['records'][1]['Visits'];
if ($totalVisits > 0) {
    $newVisits = round(($executive['Visits by New and Returning']['records'][0]['Visits'] / $totalVisits) * 100, 2);
    $retVisits = round(($executive['Visits by New and Returning']['records'][1]['Visits'] / $totalVisits) * 100, 2);
} else {
    $newVisits = 0;
    $retVisits = 0;
}
?>
<fieldset class="graph graphwide">
<legend>New &amp; Returning</legend>
<table class="horizGraph" cellspacing="0" cellpadding="5">
<thead>
<tr><td colspan="2" class="label">Percentage of new and returning visitors</td></tr>
<tr><th width="<?php echo floor($newVisits)?>%" align="right"><?php echo ereg_replace('Visitor', '', $executive['Visits by New and Returning']['records'][0]['Visitor Types'])?></th>
    <th width="<?php echo floor($retVisits)?>%" align="left"><?php echo ereg_replace('Visitor', '', $executive['Visits by New and Returning']['records'][1]['Visitor Types'])?></th></tr>
</thead>
<tbody>
<tr><td width="<?php echo floor($newVisits)?>%" class="newVisits">
<?php echo $newVisits?>%
</td>
<td width="<?php echo floor($retVisits)?>%" class="retVisits">
<?php echo $retVisits?>%
</td></tr>
</tbody>
</table>
</fieldset>

<?php endif;?>

<?php if ($google):?>
<h2>Search Engine Optimization</h2>

<?php endif;?>
*/ ?>

<br clear="all"/>

<div class="donate">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
If you find this plugin helpful, please consider donating a few dollars to help support this plugin's development. Thanks!
<br>
<br>

<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but04.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" />

<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHRwYJKoZIhvcNAQcEoIIHODCCBzQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkx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